package com.cloudcc.frame.comclass;

import com.cloudcc.deveditor.core.CCObject;
import com.cloudcc.deveditor.core.CCService;
import com.cloudcc.deveditor.core.UserInfo;
import com.cloudcc.deveditor.trigger.TriggerEditor;
import net.sf.json.JSONObject;

public class TestUpdate extends TriggerEditor {
    private CCService cs;
    private UserInfo userInfo;

    public TestUpdate(UserInfo userInfo) {
        this.userInfo = userInfo;
        cs = new CCService(userInfo);
    }

    public JSONObject updateRecord(String recordId) throws Exception {
         //详细页面测试
         CCObject accobj=new CCObject("Account");
         JSONObject rtnObj=new JSONObject();
         accobj.put("id",recordId); accobj.put("nsr","222");
         cs.update (accobj);
         rtnObj.put("status","000");
         //自定义的返回字段
         rtnObj.put("action","alert");
         rtnObj.put("message","更新年收入成功");
         rtnObj.put("action","refresh");
         rtnObj.put("mode","now");
        //返回详细页面 链接
         rtnObj.put("url","/#/commonObjects/detail/"+recordId+"/DETAIL");
         return rtnObj;
            }
         }

